This tutorial is a guide to using QGIS to download and map data from OpenStreetMap. OpenStreetMap, or OSM, is a free, editable map of the world created and edited entirely by volunteer contributors known as mappers. QGIS is a free, open-source geographic information system, or GIS, application that allows users to view, edit, visualize, and analyze geographic data. This tutorial is intended to guide a complete beginner to OpenStreetMap and GIS software through the process of creating a simple, informative map.
In this tutorial, we will be mapping parks and playgrounds in Baltimore, Maryland.
The first step is to download QGIS, the software that we’ll be using to view data from OpenStreetMap and create maps. Go to this link to download the latest version for Windows or Mac. If you are using a Windows computer, download the “standalone installer” (shown below) instead of the “network installer”. Then, follow the prompts to install QGIS on your computer like you would with any other program.
Open up QGIS. The first thing you might notice is that this is a mapping software, but there isn’t a map on the screen! Let’s change that by adding a simple basemap. A basemap is like a background image for your map. It might include some basic features like state borders, mountains, rivers, or notable monuments that give readers some geographic context, but it should be subtle enough so that the most important features of your map (in this case, parks and playgrounds) stand out.
One easy way to add basemaps in QGIS is to use the QuickMapServices plugin. Just like your browser, QGIS features a large collection of plugins, which users can install to add additional functionality to the software. To install the QuickMapServices plugin, first go to Plugins --> Manage and Install Plugins....
Then, search for “quickmapservices” in the search bar, click QuickMapServices, and then click Install Plugin. The plugin should take a few seconds to install.
While we’re here, let’s also install the QuickOSM plugin. This plugin will let us search for and download data from OpenStreetMap. Search for “quickosm” and install that plugin just like you installed QuickMapServices.
QuickMapServices is the little blue globe icon in the toolbar. Clicking on the icon shows a few basemaps built into the plugin. Let’s try adding the OpenStreetMap Standard as a base for our map.
We have a map! Try zooming in on Baltimore. You can do so by using the scroll wheel on your mouse or the magnifying glass icon. If you click and drag the mouse with the magnifying glass option to draw a box, the map will zoom in so that that box fills your screen.
That’s Baltimore, alright. As you’ll see, this map includes tons of information, including roads, parks, airports, waterways, municipality names, and county boundaries. This is really useful for getting a full geographic picture of the city, but if we’re just trying to highlight the city’s parks and playgrounds, it’s probably more information than we need, and it’ll make it hard to see some of the smaller ones.
In the bottom left corner of your screen in the “Layers” panel, try unchecking the box next to “OSM Standard”. What happens? And what happens if you re-check the box? Now, go back to the QuickMapServices button and try adding a different basemap. What do you see in the Layers panel?
As the name implies, maps in QGIS are made up of layers. The “OSM Standard” layer corresponds to the OSM Standard basemap that we added. Unchecking the box turns the layer “off”, meaning we don’t see it anymore. When you added the second basemap, that showed up as another layer. The order of layers is very important. Layers will cover up any layers that are underneath. Try clicking and dragging the layers to change their order. Do you see any changes on the map? (Make sure the boxes for your layers are checked when you try this).
QuickMapServices comes with a few very nice basemaps, but the selection is limited. We can add more basemaps by going to QuickMapServices --> Settings --> More Services --> Get contributed pack.
Try out some of those new basemaps we just added. The screenshots in the rest of this tutorial will use Stamen --> Stamen Toner Background as the basemap, but feel free to use whichever basemap you like!
Next, we need to download the data we’re interested in from OpenStreetMap: Baltimore’s parks and playgrounds. Click the green magnifying class on the toolbar, the icon for the QuickOSM plugin we just installed.
A screen pops up for QuickOSM, and by default it’s open on the Quick Query tab. For this tutorial, we’ll be sticking with Quick Query and its simple interface. As you continue working with OSM, however, you might find that Quick Query doesn’t provide the flexibility you need to download certain datasets. In those cases, you’ll want to refer to the Query tab, which lets you write customized queries to OpenStreetMap’s Overpass API.
Take a closer look at the Quick Query tab. The first two fields are Key and Value. We don’t know what those are yet, so let’s skip those for now. The third field, labeled “In” by default, seems intuitive - it’s the name of the place for which we want to download data. If we enter in “Baltimore, Maryland”, we see a message at the bottom of the window that says “All OSM objects in Baltimore, Maryland are going to be downloaded.”
Experiment with other options in the drop-down menu. What do you think is the difference between “Canvas Extent” and “Layer Extent”?
Switch the drop-down option back to “In”, and take another look at the message. We definitely want to download data for Baltimore, so that part is correct, but we don’t want all OSM objects, just the parks and playgrounds. How do we find those? Let’s start with the parks.
All OSM objects in Baltimore, Maryland are going to be downloaded.
There’s a ton of data in OSM, but each data point consists of two pieces of information:
The Geography: This is the where. For a building, the geography consists of the building’s location on the Earth (its coordinates and/or its street address) as well as its shape.
The Tag: This is the what. What kind of building is it? A tag in OSM consists of two parts: a key and value. The key represents the broader category, and the value provides the more specific detail. For instance, a department store might be tagged with the key “building” and the value “retail”. In OSM, you’ll usually see the tag represented as key=value, so, in this case, the full tag for a department store would be building=retail.
Now we know that we need to find the combination of key and value that will give us parks. The best place to find this information (and most information about OSM) is the OpenStreetMap Wiki. Try searching for “park” in the search bar. You’ll automatically be linked to this page shown below.
Based on the Wiki page, we see that parks are recorded in OSM as leisure=park. With that in mind, let’s go back to QuickOSM and enter those values into the search. You can type the values in yourself or use the dropdown menus to find them. After you’ve typed in the tag, click “Run query”. After a few seconds, you should receive a message that your query was successful!
Close the QuickOSM window to return to your map. Take a look at the “Layers” panel. What do you see?
Three layers that begin with “leisure_park” have been added to the map, and each one has a different icon next to it - a dot, a line, and a square. These icons correspond to different parks on the map, and they mean that each park is represented as a point, a line, or a polygon. What does each of those mean?
Point: This is a park whose location is recorded in OSM, but not its exact area or footprint. This is likely because the mapper who first added the park to OSM wasn’t able to draw its shape on the map, and no one else has gotten around to doing so.
Let’s take a closer look at some of these points. Each park we downloaded from OSM is represented visually on the map, but it’s also represented in a table that gives us more information, like the park’s name. We can access this table by right-clicking on the layer and opening the Attribute Table.
Click through the table to get a sense of the information available. Notice that many of the fields are empty. While most of the parks have a name recorded in OSM, some of them do not, and mappers will need to add that information in the future. For now, let’s scroll down to “Kirk Avenue Athletic Field” and then select it by clicking on the row number (the number “18” in the picture below).
Then, right-click on the row, press “Zoom to Feature”, and return to the map.
You’ll see that one of the points in the center of your map is now shaded yellow (the selected park). Zoom into it.
We know that this is the Kirk Avenue Athletic Field, but on the map, it just shows up as a dot. Can we be sure there’s actually a park there? Try adding a satellite image basemap (using QuickMapServices like we did before) and take a look. Hint: Bing Satellite is a good choice.
The satellite image confirms that an athletic field is there, but it hasn’t been fully mapped yet. If you’d like, you can contribute to OSM by drawing the park’s shape yourself! See (this link) for a beginner’s guide to contributing to OpenStreetMap.
Lines: Lines are typically used in OSM to map features like roadways or paths rather than parks. In this case, we can take a look at the attribute table and see that there are only three entries, none of which has a name.
While it’s possible that these entries do correspond to real-world parks, and they were simply drawn incorrectly and coded with very little information, we’ll treat these parks as data errors in OSM for now and to remove them from the map. You can remove layers in QGIS by right-clicking on the layer and clicking “Remove Layer…”
Polygons: The polygons are parks that are “fully mapped” in OSM, meaning OSM knows both their location and their overall shape. Try zooming in on one of the polygons and turning the layer on and off (using the checkboxes in the Layers panel). Does the shape of the polygons line up with the shape of the park in the satellite image?
For this part of the tutorial, try downloading Baltimore’s playgrounds from OSM and adding them to the map. Are most of the feature you download points, lines, or polygons?
Hint: Check here if you have trouble finding the tag for playgrounds.
After you have successfully added the playgrounds, remove the points layer so that there is only a polygon layer for playgrounds remaining. Your layers panel should look like the below (note that the colors and basemaps listed may look different).
QGIS also allows you to perform geographic analyses with the features on your map. If you ever wanted to know, for example, what percentage of a city’s population lives within half a mile of a park, QGIS is a great tool for the job. In this section, let’s answer a simple question: how big are the parks in Baltimore in acres?
First, open the Attribute Table for the parks polygon layer. Then, make the layer editable so we can add a column.
Next, open the Field Calculator. As the name suggests, this is used for performing calculations on your data. You can perform mathematical operations on your data (like adding or subtracting columns) or geometric operations, like calculating the area of a polygon.
In the Field Calculator, name your Output field as “Area” or a name of your choice. Make sure to change the Output field type to “Decimal number (real)”. Then, in the middle panel, expand the Geometry menu and double-click $area. The Expression field will be populated with $area. Click OK. Then, save your edits.
We now have an area column, but since it doesn’t have any units associated with it, it’s hard to understand what it means.
To find the units, we can go to Project --> Properties... and then the General tab. We see that the units provided are in meters/square meters.
To calculate the areas into acres, we can go back to the Field Calculator and update the new Area field we just created. This time, divide $area by 4047 to convert from square meters to acres. Click OK and save your edits once more.
You’ve just successfully added a column to your data that provides the land area in acres for every park in Baltimore!
Disclaimer: Note that this section skipped discussing coordinate reference systems and projection systems for geographic data, as they are beyond the scope of this tutorial. For geographic analyses requiring more precise measurements, it’s highly recommended that you project your data using a projection system appropriate for your study area. See this tutorial for more information.
The last step in this tutorial is to stylize our map and prepare it for printing and presentation. You can double-click on any layer in the Layers panel to open its properties. Double-click the playgrounds polygon layer and navigate to the Symbology panel.
Here, you can see a menu of different options for the modifying the layer’s aesthetics, including its fill color, border, and transparency. Pre-set options are available at the bottom, and pressing the green plus icon provides several more options. Try modifying the playgrounds however you’d like (have fun with it!).
That was an example of a simple fill - every playground in the layer has the same aesthetics, regardless of any differences among them. For the parks polygon layer, let’s try coloring each park based on its size. The bigger the park, the darker its shade of green will be. Open the Symbology menu for the parks polygon layer and switch the drop-down option at the top from “Single symbol” to “Graduated”. In the Value field, add the Area column that we created earlier. Then, click the arrow to the right of the Color ramp drop-down menu and choose one of the options. Lastly, click Classify in the bottom-left of the menu and then OK.
You should see that larger parks are darker and smaller parks are lighter.
Note that you can also modify the aesthetics for your basemap layers. This can be helpful if you’re using a satellite image basemap but don’t want your map to look too busy.
To this point, we’ve been using the QGIS window to navigate and explore our data. Now that we’re turning to the task of laying out our final map, however, we need to use the Print Layout, which lets us preview how our map will look printed on the page. To open the Print Layout, go to Project --> New Print Layout... and enter a name for your map file.
You’ll be greeted with a completely blank page. As a first step, right-click on the canvas (the white part of the screen). Change the paper Size to “Letter” and the Orientation to “Portait”. You should see the canvas change as you click these options.
Now, click the Add Map button and then draw a box on your canvas that corresponds to where you’d like to see the map on your printed page. After you draw the box, you should see your map of Baltimore appear on the page.
The map will be zoomed into roughly where it was zoomed in on the main QGIS window. Still, it may not be zoomed or centered to your liking. To adjust the map, click the Move item content button and then click and drag on the map to adjust its extent. Use your scroll wheel to zoom in and out, and, if you’re having trouble getting the zoom just right, adjust the Scale in the Item Properties panel on the right side of your screen.
If you don’t like how your updated map aesthetics look on the page, you can go back to the main QGIS window, adjust the aesthetics as you’d like, and then hit the Refresh button on the Print Layout view. This will update your map’s appearance to match its appearance in the main window.
Once you’ve got your map layout looking just how you’d like it, we can add other components to the map like a title, legend, and scale bar. To add a title, click the Add label and draw a box where you’d like the title to go. You can use the Item Properties panel to change the text and its aesthetics.
Next, click the Add Legend and draw a box for your legend. By default, it will include all of the layers from your main QGIS window using their default names. These won’t be very intuitive for your readers, so let’s edit them!
To do so, uncheck the Auto update box in the Item Properties panel. This will “unlink” the legend from your main QGIS window, allowing you to update the legend as you’d like. To remove layers (like basemaps), highlight the layer and click the red minus sign. To rename layers, double-click on the layer and modify the text.
Finally, let’s add a scale bar. Click the Add Scale Bar button and draw a box. You can experiment with the options in the Item Properties panel to modify the units, size, style, and intervals of the scale bar.
Take some more time to explore the other buttons and features in the Print Layout view. Make any additional aesthetic tweaks that you would like until you’re happy with your map. Once you’re ready, the last step is for us to export the map. There are several options for export format, but probably the easiest is PDF. Click the Export as PDF button and then save the map with an informative title. When the PDF Export Options menu pops, click Save.
You should now be able to share the map and view it on any computer like a standard PDF. Congratulations! You just made your first map in QGIS with OpenStreetMap data.